A Calculus for Overloaded Functions with Subtyping ( extended abstract )

نویسندگان

  • Giuseppe Castagna
  • Giorgio Ghelli
  • Giuseppe Longo
چکیده

We present a simple extension of typed-calculus where functions can be overloaded by adding diier-ent \pieces of code". In short, the code of an overloaded function is formed by several branches of code; the branch to execute is chosen, when the function is applied, according to a particular selection rule which depends on the type of the argument. The crucial feature of the present approach is that a subtyping relation is deened among types, such that the type of a term generally decreases during computation, and this fact induces a distinction between the \compile-time" type and the \run-time" type of a term. We study the case of overloaded functions where the branch selection depends on the run-time type of the argument, so that overloading cannot be eliminated by a static analysis of code, but is an essential feature to be dealt with during computation. We obtain in this way a type-dependent calculus, which diiers from the various ?calculi where types do not play, essentially, any r^ ole during computation. We prove Connuence and Strong Normalization for this calculus as well as a generalized Subject-Reduction theorem The deenition of this calculus is driven by the understanding of object-oriented features and the connections between our calculus and object-orientedness are extensively stressed. We show that this calculus provides a foundation for typed object-oriented languages which solves some of the problems of the standard record-based approach. It also provides a type-discipline for a relevant fragment of the \core frame-work" (see Kee89]) of CLOS. Permission of copy all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish requires a fee and/or speciic permission 1 Introduction.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

A Calculus for Overload Functions with Subtyping

We present a simple extension of typed-calculus where functions can be overloaded by putting diierent \branches of code" together. When the function is applied, the branch to execute is chosen according to a particular selection rule which depends on the type of the argument. The crucial feature of the present approach is that the branch selection depends on the \run-time type" of the argument ...

متن کامل

Encoding CDuce in the Cπ-calculus?

CDuce is a functional programming language featuring overloaded functions and a rich type system with recursive types, subtyping, union, negation and intersection types. The boolean constructors have a set-theoretic behaviour defined via a semantic interpretation of the types. The Cπ-calculus is an extension of the π-calculus that enriches Pierce and Sangiorgi π-calculus subtyping with union, i...

متن کامل

Combining Inheritance and Parametric Polymorphism in a Functional Database Language

We consider extending a functional database language to support subtyping, inheritance and method overloading. We do so by extending previous work on type inference with subtypes for the pure calculus to cater for structured types, ML-style parametric polymorphism and overloaded function deenitions. We attach semantics to overloaded functions by developing a generalisation of best-t pattern-mat...

متن کامل

Typed Homomorphic Relations Extended with Subtypes

Typed homomorphic relations on heterogeneous algebras are generalized to allow relationships between elements in the carrier sets of di erent types. Such relations are needed for the model theory of incomplete, hierarchical speci cations with subtypes. Typed logical relations are generalized similarly. These tools help give a simple model-theoretic account of subtyping among abstract data types...

متن کامل

Typed Homomorphic Relations Extended with Sybtypes

Typed homomorphic relations on heterogeneous algebras are generalized to allow relationships between elements in the carrier sets of different types. Such relations are needed for the model theory of incomplete, hierarchical specifications with subtypes. Typed logical relations are generalized similarly. These tools help give a simple model-theoretic account of subtyping among abstract data typ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1995